package pear.gui;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import lombok.BoundPropertySupport;
import lombok.BoundSetter;
import lombok.Getter;
import lombok.Setter;
import pear.hostingClasses.Hosting;
import pear.hostingClasses.PCTRHosting;
import pear.other.HostingInterface;
import pear.other.Helper;

/**
 *
 * @author Dingo
 */
@BoundSetter
@Getter
@BoundPropertySupport
public class UploadPanelHelper implements PropertyChangeListener, Serializable {

    private List<Hosting> hostingList;
    private Hosting selectedHosting;
    private String selectedHostingDescription = "";
    private int maxSliderValue = 10;
    private int segmentSize = 1;
    private String filePath = null;

    public UploadPanelHelper() {
        hostingList = new ArrayList<>();
        //TODO: implementacja zasysania z paczki :-)
        hostingList.add(new PCTRHosting());
        hostingList.add(new PCTRHosting());
        hostingList.add(new PCTRHosting());
        hostingList.add(new PCTRHosting());
        addPropertyChangeListener(this);
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt) {
        if (evt != null && selectedHosting != null
                && PROP_SELECTED_HOSTING.equals(evt.getPropertyName())) {
            setSelectedHostingDescription("Maksymalny rozmiar: "
                    + selectedHosting.MAXSIZE + "MB" + "\n" + "Opis: "
                    + selectedHosting.DESCRIPTON);
            setMaxSliderValue(selectedHosting.MAXSIZE);
        }
    }
}
